package com.zt.dev.accessProduct.service.impl;

import com.zt.dev.accessProduct.mapper.AccessProductMapper;
import com.zt.dev.accessProduct.pojo.AccessProductReport;
import com.zt.dev.accessProduct.pojo.AccessProductTemplate;
import com.zt.dev.accessProduct.service.AccessProductService;
import com.zt.dev.physicalequipment.pojo.PhysicalEquipmentMessage;
import com.zt.dev.siteInfoRegister.mapper.SiteMapper;
import com.zt.dev.siteInfoRegister.pojo.Site;
import com.zt.dev.siteInfoRegister.service.SiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AccessProductServiceImpl implements AccessProductService {

    @Autowired
    private AccessProductMapper accessProductMapper;


    @Override
    public List<AccessProductTemplate> getAllTemplate() {
        return accessProductMapper.selectAllTemplate();
    }

    @Override
    public AccessProductTemplate getTemplateById(Integer id) {
        return accessProductMapper.selectTemplateById(id);
    }

    @Override
    public int addTemplate(AccessProductTemplate accessProductTemplate) {
        return accessProductMapper.insertTemplate(accessProductTemplate);
    }

    @Override
    public int removeTemplate(Integer id) {
        return accessProductMapper.deleteTemplate(id);
    }

    @Override
    public int modifyTemplate(AccessProductTemplate accessProductTemplate) {

        return accessProductMapper.updateTemplate(accessProductTemplate);
    }

    @Override
    public List<AccessProductTemplate> getAllTemplatePage(Integer currentPage, Integer pageSize) {
        Integer jumpTotal = (currentPage-1)*pageSize;
        return accessProductMapper.selectAllTemplatePage(jumpTotal,pageSize);
    }

    @Override
    public List<AccessProductReport> getAllReportPage(Integer currentPage, Integer pageSize) {
        Integer jumpTotal = (currentPage-1)*pageSize;
        return accessProductMapper.selectReportPage(jumpTotal,pageSize);
    }

    @Override
    public AccessProductReport getReportById(Integer id) {
        return accessProductMapper.selectReportById(id);
    }

    @Override
    public int addReport(AccessProductReport accessProductReport) {
        return accessProductMapper.insertReport(accessProductReport);
    }

    @Override
    public int removeReport(Integer id) {
        return accessProductMapper.deleteReport(id);
    }

    @Override
    public int modifyReport(AccessProductReport accessProductReport) {
        return accessProductMapper.updateReport(accessProductReport);
    }
}
